<?php
ob_start();
?>
<?php
include ('encabezado.php');
?>
<form action="" method="POST">
<br><br>
<table align="center" border="2">
<tr>

<td align="center">
<h2>Choose group <br></h2>
<?php
	//guardarlo en la sesion
	if($_SERVER['REQUEST_METHOD'] == 'POST')
	{
	 $choosengroup = $_POST['solucion'];
	 
	 session_start();
	 $_SESSION['choosen'] = $choosengroup;
	 //cargar page
	 header('Location: index.php');
	}
	$conexion = mysql_connect("$ip", "$userdb", "$passworddb");
	mysql_select_db("$db", $conexion);
	$q = 'select * from Groups where Name != "Teacher"';
	$losgrupos= mysql_query($q, $conexion) or die ("problema con query");
	print "<select name=\"solucion\">";
	while ($registro = mysql_fetch_array($losgrupos))
	{
		print "<option value=\"{$registro['Name']}\" name=\"{$registro['GroupID']}\">{$registro['Name']}</option>";
	}
	print "</select><br><br>";
?>
<input type="submit" value="Choose group"/>
<input type="hidden" value="true"/>
</td></tr>
</table>
</form>
<?php
include ('pie.php');
?>
<?php
ob_end_flush();
?>